<template>
  <div class="detail">
    <van-nav-bar
      title="详情页"
      left-arrow
      left-text="返回"
      class="header"
      @click-left="onClickLeft"
    />

    <ImgItem :item="itemObj" />
  </div>
</template>

<script>
import { getDetailList } from '@/api';
import ImgItem from '@/components/ImgItem';

export default {
  name: 'Detail',
  props: ['id'],
  data() {
    return {
      itemObj: {}
    }
  },
  async created() {
    const datailList = await getDetailList({ id: this.id });
    this.itemObj = datailList.data;
  },
  methods: {
    // 按钮返回
    onClickLeft() {
      this.$router.push('/index/home');
    },
  },
  components: {
    ImgItem
  }
}
</script>

<style lang='scss'>
.header {
  background-image: linear-gradient(90deg,#0af,#0085ff);
  color: #fff;
  .van-nav-bar__text, .van-nav-bar__arrow, .van-nav-bar__title {
    color: #fff;
  }
}
</style>
